package com.dd.common.dto.system.dict;

import com.dd.common.pojo.dto.group.CreateGroup;
import com.dd.common.pojo.dto.group.UpdateGroup;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.hibernate.validator.constraints.Range;

import javax.validation.constraints.*;

/**
 * @author cheng
 */
@Schema(description = "字典类型DTO")
@Data
public class SysDictTypeDTO implements java.io.Serializable {
    @Null(message = "ID必须为空", groups = CreateGroup.class)
    @NotNull(message = "ID不能为空", groups = UpdateGroup.class)
    @Schema(description = "ID", example = "1")
    @Min(value = 1, message = "ID必须是正整数")
    private Long id;

    @NotBlank(message = "字典类型名称不能为空", groups = CreateGroup.class)
    @Schema(description = "字典类型名称，如：用户状态、性别", example = "用户状态")
    private String dictName;
    @NotBlank(message = "字典类型标识符不能为空", groups = CreateGroup.class)
    @Pattern(regexp = "^[a-zA-Z_][a-zA-Z0-9_]*$", message = "字典类型标识符只能包含字母、数字、下划线，且不能以数字开头")
    @Schema(description = "字典类型标识符，如：user_status、sex", example = "user_status")
    private String dictType;

    @Schema(description = "状态：1-正常，0-禁用", example = "1")
    @Range(min = 0, max = 1, message = "状态值只能是0或1")
    private Integer status;
    @Schema(description = "字典描述备注", example = "用户状态字典")
    private String remark;
}
